import React from 'react';
//组件通信——父传子:父组件把传递的属性写到子组件标签上,子组件用props接收,直接用就行
interface SonProps {
  name: string;
  age: number;
}
const Son: React.FC<SonProps> = (props) => {
  const { name, age } = props;
  return (
    <>
      <div style={{ width: '100vw', height: '100px', background: 'blue' }}>
        <h1>Son组件</h1>
        <p>
          name:{name}---age:{age}
        </p>
      </div>
    </>
  );
};
const Father: React.FC = () => {
  const name = 'wdk';
  const age = 18;
  return (
    <>
      <div style={{ width: '100vw', height: '300px', background: 'pink' }}>
        <h1>我是父组件</h1>
        <Son name={name} age={age} />
        <footer>
          <h2>父组件</h2>
        </footer>
      </div>
    </>
  );
};
export default Father;
